<template>
  <div>
    <!-- 标题 -->
    <div class="rank1">
      <p>人效排名&nbsp;(月度)</p>
      <el-select v-model="value" placeholder="全部区域" size="mini">
        <el-option
          v-for="item in options"
          :key="item.value"
          :label="item.label"
          :value="item.value"
        >
        </el-option>
      </el-select>
    </div>
    <!-- 选择框 -->
    <div class="rank2">
      <p @click="bian(true)">运营人员</p>
      <p @click="bian(false)">运维人员</p>
    </div>
    <!-- 分类,排行榜 -->
    <table class="rank3" v-if="sssk">
      <tr>
        <th></th>
        <th>姓名</th>
        <th>工作量</th>
      </tr>
      <tr v-for="(item, index) in taskList" :key="index">
        <td>{{ item }}</td>
        <td>{{ item }}名字</td>
        <td>{{ item }}</td>
      </tr>
    </table>
    <div v-else class="ranelse"><div class="hhh"></div></div>
  </div>
</template>

<script>
import { taskTop10 } from '@/api/personnel'
export default {
  name: 'aa-a',
  data () {
    return {
      taskTop: {
        start: '2020-11-01', // 开始日期
        end: '2020-11-31', // 结束日期
        isRepair: true, // true：运维工单;false：运营工单是否是运维工单
        regionId: 0 // 区域Id(如果是全部区域，请传0)
      },
      taskList: {}, // 储存获取的数据
      sssk: true,
      options: [
        {
          value: '选项1',
          label: '全部区域'
        },
        {
          value: '选项2',
          label: '金燕龙'
        },
        {
          value: '选项3',
          label: '回龙观'
        },
        {
          value: '选项4',
          label: '育新'
        },
        {
          value: '选项5',
          label: '云梦泽'
        },
        {
          value: '选项6',
          label: '上地'
        }
      ],
      value: ''
    }
  },
  created () {
    this.taskTop10()
  },
  methods: {
    bian (nam) {
      // 是否是运维工单
      this.taskTop.isRepair = nam
    },
    async taskTop10 () {
      // 申请排行榜数据
      try {
        await taskTop10(this.taskTop)
      } catch (e) {
        this.sssk = false
        console.log(e)
      }
    }
  }
}
</script>

<style scoped lang="scss">
.rank1 {
  width: 150vh;
  height: 13vh;
  line-height: 13vh;
  display: flex;
  margin-left: 2vh;
  p {
    font-size: 4vh;
    font-weight: 700;
  }
  .el-select .el-input__inner {
    width: 10px;
  }
}
.rank2 {
  width: 150vh;
  height: 6vh;
  line-height: 6vh;
  display: flex;
  margin-left: 2vh;
  p {
    width: 25%;
    text-align: center;
    line-height: 6vh;
    border: 1px groove #000000;
  }
}
.rank3 {
  position: relative;
  margin-left: 2vh;
  th:first-child {
    width: 10vh;
  }
  th {
    width: 45vh;
  }
}
.ranelse {
  position: absolute;
  left: 130%;
  top: 90%;
  transform: translate(-50%, -50%);
  width: 100%;
  height: 50vh;
  margin: 10px;
  padding-right: 20px;
  // background-color: rgb(141, 75, 75);
  background: url("https://likede2-admin.itheima.net/img/empty.87c4f71b.png")
    no-repeat;
}
</style>
